package com.bl.controller;


import com.bl.domain.User;
import com.bl.service.IUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/user")
public class UserController {

    @Value("${server.port}")
    private String port;

    @Autowired
    private IUserService userService;

    @GetMapping("/getById/{id}")
    public User geById(@PathVariable("id") Long id){
        return new User( id,"张三","哈哈哈 !!!   端口号:" + port);
    }


    /**
     * 接口：查询所有
     * @return
     */
    @GetMapping("/findAll")
    public List<User> findAll(){
        return userService.loadAll();
    }






}
